const koa = require('koa');
const session = require('koa-session');

let server=new koa();

server.listen(8080);
server.keys=['adsadas']
server.use(session({
    maxAge:20*60*1000     //20分钟后过期
},server))

server.use((ctx)=>{
    if(ctx.session['n']){
        ctx.session['n']++;
    }else{
        ctx.session['n']=1;
    }
    
    ctx.response.body=`您是第${ctx.session['n']}次访问本站`
    

})